<template>
  <a-card :bordered="false">
    <content-header title="队列服务"></content-header>
    <a-alert
      style="margin-bottom: 20px"
      message="队列服务用于处理数据导入、数据导出、消息推送等需大量占用服务器资源或实时性要求不高的业务场景，通过异步处理分担服务器压力"
      type="warning"
      show-icon
    />
    <div class="content">
      <h4 class="title">第一步、启动Redis服务</h4>
      <p class="text">
        <span class="mr-5">队列服务需要依赖Redis</span>
        <a href="https://www.yiovo.com/doc/10051" target="_blank">点击查看Redis服务启动教程</a>
      </p>
      <h4 class="title">第二步、启动队列服务</h4>
      <p class="text">
        <a href="https://www.yiovo.com/doc/10062" target="_blank">点击查看队列服务启动教程</a>
      </p>
      <h4 class="title">第三步、测试队列服务是否启动</h4>
      <p class="text mtb-10">
        <a-button :loading="isBtnLoading" @click="handleTest()">点击测试</a-button>
      </p>
      <p class="text">
        <span>测试过程可能需要5秒-10秒钟时间</span>
      </p>
    </div>
  </a-card>
</template>

<script>
import * as Api from '@/api/setting/queue'
import { ContentHeader } from '@/components'

export default {
  components: {
    ContentHeader
  },
  data () {
    return {
      // 正在提交
      isBtnLoading: false
    }
  },
  created () {
  },
  methods: {

    /**
     * 点击测试
     */
    handleTest () {
      this.isBtnLoading = true
      Api.test()
        .then(result => {
          this.$message.success(result.message, 5)
        })
        .finally(() => this.isBtnLoading = false)
    },

  }
}
</script>

<style lang="less" scoped>
.content {
  padding: 20px 30px;
  .title {
    margin-top: 50px;
    margin-bottom: 10px;
    font-size: 15px;
    // font-weight: 600;
    &:first-child {
      margin-top: 0;
    }
  }
  .text {
    margin: 6px 0;
  }
}
</style>